Crate scale_decode
source · [−]Expand description
This crate is concerned with decoding arbitrary values from some SCALE encoded bytes, given a type ID and type registry that defines the expected shape that the bytes should be decoded into.
In order to allow the user to decode bytes into any shape they like,
you must implement a visitor::Visitor
trait, which is handed
values back and has the opportunity to transform them into some
output representation of your choice (or fail with an error of your
choice). This Visitor is passed to the decode()
method, whose job it
is to look at the type information provided and pass values of those
types to the Visitor, or fail if the bytes do not match the expected
shape.
Modules
Functions
Decode data according to the type ID and
PortableRegistry
provided.
The provided pointer to the data slice will be moved forwards as needed
depending on what was decoded, and a method on the provided Visitor
will be called depending on the type that needs to be decoded.